package lyj.springcloud.controller;

import lyj.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PaymentController {

    @Autowired
    private PaymentService service;

    @GetMapping("/payment/ok/{id}")
    public String paymentOk(@PathVariable("id")String id) {
        System.out.println("》》》》》" + id);
        return service.paymentOk(id);
    }

    // todo 服务降级
    @GetMapping("/payment/timeout/{id}")
    public String paymentTimeout(@PathVariable("id") String id) {
        return service.paymentTimeout(id);
    }

    // todo 服务熔断
    @GetMapping("/payment/circuitbreaker/{id}")
    public String circuitBreaker(@PathVariable("id") Integer id) {
        return service.circuitBreaker(id);
    }
}
